<html>
<head><meta charset="utf-8"><title>Why is this enum variant matched this way using a `_` app... · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html">Why is this enum variant matched this way using a `_` app...</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="236856279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236856279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236856279">(Apr 30 2021 at 15:44)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/7506228e2e688517ae142fc385f13b30c4ce07f1/compiler/rustc_mir/src/transform/check_consts/validation.rs#L429">https://github.com/rust-lang/rust/blob/7506228e2e688517ae142fc385f13b30c4ce07f1/compiler/rustc_mir/src/transform/check_consts/validation.rs#L429</a></p>



<a name="236856467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236856467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236856467">(Apr 30 2021 at 15:45)</a>:</h4>
<p>does it have anything to do with this?: <a href="https://medium.com/codechain/rust-underscore-does-not-bind-fec6a18115a8">https://medium.com/codechain/rust-underscore-does-not-bind-fec6a18115a8</a><br>
maybe there is a quick answer</p>



<a name="236856761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236856761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236856761">(Apr 30 2021 at 15:47)</a>:</h4>
<p>i think that's so that it's clear which fields we're ignoring here</p>



<a name="236856800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236856800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236856800">(Apr 30 2021 at 15:47)</a>:</h4>
<p>it does not influence the program behavior</p>



<a name="236857491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236857491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236857491">(Apr 30 2021 at 15:52)</a>:</h4>
<p>there are only two fields in that enum</p>



<a name="236857541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236857541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236857541">(Apr 30 2021 at 15:52)</a>:</h4>
<p>it seems obvious which of the two isn't being provided</p>



<a name="236857743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236857743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236857743">(Apr 30 2021 at 15:54)</a>:</h4>
<p>though ofc with the <code>_</code> there is no difference between <code>_</code> and <code>_foo</code></p>



<a name="236858126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236858126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236858126">(Apr 30 2021 at 15:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281739">oliver</span> <a href="#narrow/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E/near/236857541">said</a>:</p>
<blockquote>
<p>it seems obvious which of the two isn't being provided</p>
</blockquote>
<p>if you know what the second field of <code>PredicateKind::Trait</code> is</p>



<a name="236858183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236858183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236858183">(Apr 30 2021 at 15:57)</a>:</h4>
<p>for people reading this code who do not know the enum definition it's not obvious that this variant has a field to represent the <code>constness</code></p>



<a name="236864797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236864797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236864797">(Apr 30 2021 at 16:42)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> ?</p>



<a name="236956087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236956087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236956087">(May 01 2021 at 10:26)</a>:</h4>
<p>Honestly I didnt think much about it. <code>constness</code> was previously used, my patch made it unused. Just adding a leading <code>_</code> preserves more information and required less typing than removing the name entirely.</p>



<a name="236956152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Why%20is%20this%20enum%20variant%20matched%20this%20way%20using%20a%20%60_%60%20app.../near/236956152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E.html#236956152">(May 01 2021 at 10:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/122651-general/topic/Why.20is.20this.20enum.20variant.20matched.20this.20way.20using.20a.20.60_.60.20app.2E.2E.2E/near/236856761">said</a>:</p>
<blockquote>
<p>i think that's so that it's clear which fields we're ignoring here</p>
</blockquote>
<p>so, basically this ^</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>